<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title>主页一</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <link rel="stylesheet" href="../../static/lib/layui-v2.9.8/css/layui.css" media="all">
    <link rel="stylesheet" href="../../static/lib/font-awesome-4.7.0/css/font-awesome.min.css" media="all">
    <link rel="stylesheet" href="../../static/css/public.css" media="all">
</head>
<style>
    .layui-top-box {padding:40px 20px 20px 20px;color:#fff}
	.layuimini-qiuck-module {text-align:center;margin-top: 10px}
	.layuimini-qiuck-module a i {display:inline-block;width:80%;height:70px;line-height:70px;text-align:center;border-radius:2px;font-size:30px;background-color:#55aa7f;color:#ffaa00;transition:all .3s;-webkit-transition:all .3s;}
	.layuimini-qiuck-module a cite {position:relative;top:2px;display:block;color:#666;text-overflow:ellipsis;overflow:hidden;white-space:nowrap;font-size:18px;}
	.welcome-module {width:100%;height:240px;}
	.layuimini-qiuck-module1 {text-align:center;margin-top: 10px}
	.layuimini-qiuck-module1 a i {display:inline-block;width:80%;height:70px;line-height:70px;text-align:center;border-radius:2px;font-size:30px;background-color:#ffaa7f;color:#aa0000;transition:all .3s;-webkit-transition:all .3s;}
    .layuimini-qiuck-module1 a cite {position:relative;top:2px;display:block;color:#666;text-overflow:ellipsis;overflow:hidden;white-space:nowrap;font-size:18px;}
	.panel {margin-bottom:17px;background-color:#fff;border:1px solid transparent;border-radius:3px;-webkit-box-shadow:0 1px 1px rgba(0,0,0,.05);box-shadow:0 1px 1px rgba(0,0,0,.05)}
    .panel-body {padding:15px}
    .panel-title {margin-top:0;margin-bottom:0;font-size:14px;color:inherit}
    .label {display:inline;padding:.2em .6em .3em;font-size:75%;font-weight:700;line-height:1;color:#fff;text-align:center;white-space:nowrap;vertical-align:baseline;border-radius:.25em;margin-top: .3em;}
    .layui-red {color:red}
    .main_btn > p {height:40px;}
</style>
<body>
<div class="layuimini-container">
	<div class="layui-fluid">
	    <div class="layui-row layui-col-space15">
			<div class="layui-col-md12" style="padding:10px">
				<div class="layui-card">
				  <!-- <div class="layui-card-header">图表1</div> -->
				  <div class="layui-card-body">
					<div class="layui-carousel layadmin-carousel layadmin-dataview" data-anim="fade" lay-filter="LAY-index-normline">
						<div id="echarts-pie1" style="background-color:#ffffff;min-height:600px;padding: 5px"></div>
					</div>
				  </div>
				</div>
			</div>

<!-- 			<div class="layui-col-md6" style="padding:10px">
				<div class="layui-card">
				  <div class="layui-card-header">图表2</div>
				  <div class="layui-card-body">
					<div class="layui-carousel layadmin-carousel layadmin-dataview" data-anim="fade" lay-filter="LAY-index-heapline">
						<div id="echarts-pie2" style="background-color:#ffffff;min-height:600px;padding: 5px"></div>
					</div>
				  </div>
				</div>
			</div> -->
	      
	    </div>
	</div>
	
	
<!-- 	<div class="layui-row layui-col-space15">
	    <div class="layui-col-xs12 layui-col-md6">
	        <div id="echarts-pie2" style="background-color:#ffffff;min-height:400px;padding: 5px"></div>
	    </div>
	</div>
	
	<div class="layui-row layui-col-space15">
	    <div class="layui-col-xs12 layui-col-md6">
	        <div id="echarts-pie1" style="background-color:#ffffff;min-height:400px;padding: 5px"></div>
	    </div>
	</div> -->
	
	
	
</div>
<script src="../../static/lib/layui-v2.9.8/layui.js" charset="utf-8"></script>
<script type="text/javascript" src="https://assets.pyecharts.org/assets/echarts.min.js"></script>

<script>
	layui.use(['form', 'table'], function () {
	    var $ = layui.jquery;
		
		// ajax 头部增加csrf_token
		var token = "{{ csrf_token }}";
		$.ajaxSetup({
		    headers: { 'X-CSRFTOKEN': `${token}` }, // 这里是headers，不是data,  CSRF
		});
		
		var chart1 = echarts.init(document.getElementById('echarts-pie1'), 'gray', {renderer: 'canvas'});
		// var chart2 = echarts.init(document.getElementById('echarts-pie2'), 'gray', {renderer: 'canvas'});
		
		$(function(){   //js 加载时，AJAX请求
			  $.ajax({
				url:'/echarts',
				type:'post',
				dataType:'json',
				success:function(result){
					console.log(result.data);
					chart1.setOption(result.data);
				},
				error:function(){
					layer.msg('API出错!');
				}
			})
		});
		
		// function getFileApprove(){
		// 	$.ajax({
		// 		url:'/get-file-approve',
		// 		type:'post',
		// 		dataType:'json',
		// 		success:function(result){
		// 			console.log(result);
		// 			var fileApprove = result.series[0].data[0];
		// 			console.log(fileApprove.value);
		// 			chart2.setOption(result);
		// 			if (fileApprove.value > 0) {
		// 				layer.alert('您有新的文件需要审批,请及时处理!', {icon: 6 ,title:'请及时审批'});
		// 			}
		// 		},
		// 		error:function(){
		// 			layer.msg('API出错!');
		// 		}
		// 	})
		// 	return false
		// }
		
		// getFileApprove();
		
		// setInterval(function () {
		//     getFileApprove();
		// }, 60 * 1000 * 60);
	})
</script>


</body>
</html>